package com.videri.match.client;

import com.allen_sauer.gwt.dragdrop.client.drop.DropController;
import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class ImageRegion extends FocusPanel implements IsSerializable {
		private static final String CSS_MATCH_IMAGEREGION = "match-string-imageregion";
		private StringBoxDropController dropController;
		private Rectangle myRegion;
		public ImageRegion(Rectangle region, int r, int g, int b)
		{
			myRegion = region;
			addStyleName(CSS_MATCH_IMAGEREGION);
			DOM.setStyleAttribute(this.getElement(), "backgroundColor", "rgb("+r+", "+g+", "+b+")");
			dropController = new StringBoxDropController(this);
			this.setSize(myRegion.w+"px", myRegion.h+"px");
		}
		
		public int getX(){return myRegion.x;}
		public int getY(){return myRegion.y;}
		public int getWidth(){return myRegion.w;}
		public int getHeight(){return myRegion.h;}
		
		public Rectangle getRegion() {
			return myRegion;
		}
		
		public DropController getDropController()
		{
			return dropController;
		}
		
		public Widget[] getDropped() {
			return dropController.getDropped();
		}
}
